package cn.tedu.fengyuback.personal.controller;


import cn.tedu.fengyuback.base.response.JsonResult;
import cn.tedu.fengyuback.personal.pojo.dto.QuestionFollowsQuery;
import cn.tedu.fengyuback.personal.pojo.dto.QuestionQuery;
import cn.tedu.fengyuback.personal.service.PersonalService;
import cn.tedu.fengyuback.personal.service.QuestionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@RequestMapping(value = "/v1/personal/question")
public class QuestionController {
    @Autowired
    private QuestionService questionService;

    /**
     * 查询用户发布的问题
     * @param questionQuery
     * @return
     */
    @GetMapping("loadQuestion")
    public JsonResult selectQuestion(QuestionQuery questionQuery) {
        log.debug("开始处理【查询用户发布的问题】的请求，参数：{}", questionQuery);
        return JsonResult.ok(questionService.selectQuestion(questionQuery));
    }

    /**
     * 更改关注问题
     * @param questionFollowsQuery
     * @return
     */
    @PostMapping("questionsFollowStatus")
    public JsonResult updateQuestionsFollowStatus(QuestionFollowsQuery questionFollowsQuery) {
        log.debug("更改问题状态的参数={}",questionFollowsQuery);
        questionService.updateQuestionsFollowStatus(questionFollowsQuery);
        return JsonResult.ok();
    }
}
